<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <script type="text/javascript" src="../js/initPage.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>随便打TCS系统</title>
    <!-- Bootstrap -->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css"
          rel="stylesheet">
    <!-- Font Awesome -->
    <link
            href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
            rel="stylesheet">
    <!-- NProgress -->
    <link href="../vendors/nprogress/nprogress.css"
          rel="stylesheet">
    <!-- iCheck -->
    <link href="../vendors/iCheck/skins/flat/green.css"
          rel="stylesheet">
    <!-- bootstrap-progressbar -->
    <link
            href="../vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
            rel="stylesheet">
    <!-- JQVMap -->
    <link href="../vendors/jqvmap/dist/jqvmap.min.css"
          rel="stylesheet"/>
    <!-- bootstrap-daterangepicker -->
    <link
            href="../vendors/bootstrap-daterangepicker/daterangepicker.css"
            rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="../build/css/custom.min.css" rel="stylesheet">
    <link href="https://cdn.90so.net/layui/2.5.5/css/layui.css" rel="stylesheet"/>
    <style>
        .detailBox {
            background-color: #fff;
            border: 1px solid #eee;
            position: fixed;
            top: 50%;
            left: 50%;
            width: 50%;
            height: 50%;
            -webkit-transform: translateX(-50%) translateY(-50%);
            display: none;
        }

        .ShadowBox {
            width: 100%;
            height: 100%;
            position: fixed;
            top: 0;
            left: 0;
            background: rgba(0, 0, 0, 0.3);
            display: none;
        }

        .detailBox h4 {
            border-bottom: 1px solid #ccc;
            padding: 10px 20px;
        }

        .detailBox .tableBox {
            padding: 20px;
        }

        .detailBox .closeBox {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 20px;
        }
    </style>
</head>
<%@ include file="loginCheck.jsp" %>
<body class="nav-md">
<div class="container body">
    <div class="main_container">
        <div class="col-md-3 left_col">
            <div class="left_col scroll-view">
                <div class="clearfix"></div>
                <br/>
            </div>
        </div>
        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left"></div>
                    <div class="x_content">
                        充值时间段： <input type="text" id="usetime1" value="${usetime1}" style="color:#333"/> &nbsp-
                        <input type="text" id="usetime2" value="${usetime2}" style="color:#333"/>
                        <button type="submit" class="btn btn-default"
                                onclick="selectALL('${status}','1')">搜索
                        </button>

                    </div>
                </div>
                <div class="x_panel">
                    <div class="x_content">
                        <div class="ShadowBox"></div>
                        <h4>
                            充值总数量：<strong>${pages.recordTotal}张</strong>
                            充值总金额：<strong>${totalMoney}元</strong>
                            100面额：<strong>${r100}张</strong>
                            200面额：<strong>${r200}张</strong>
                            500面额：<strong>${r500}张</strong>
                            1000面额：<strong>${r1000}张</strong>
                            2000面额：<strong>${r2000}张</strong>
                            5000面额：<strong>${r5000}张</strong>
                            10000面额：<strong>${r10000}张</strong>
                            20000面额：<strong>${r20000}张</strong>
                        </h4>
                        <table id="datatable" class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>充值编号</th>
                                <th>充值账户</th>
                                <th>购物金面值</th>
                                <th>话费面值</th>
                                <th>开卡时间</th>
                                <th>充值时间</th>
                                <%--<th>操作</th>--%>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${exchargeList}" var="s" varStatus="z">
                                <tr>
                                    <td>${s.id}</td>
                                    <td><c:if test="${s.mobile==null}">
                                        无
                                    </c:if> <c:if test="${s.mobile!=null}">
                                        ${s.mobile}
                                    </c:if></td>
                                    <td><c:if test="${s.shopmoney==null}">
                                        无
                                    </c:if> <c:if test="${s.shopmoney!=null}">
                                        ${s.shopmoney}
                                    </c:if></td>

                                    <td><c:if test="${s.money==null}">
                                        无
                                    </c:if> <c:if test="${s.money!=null}">
                                        ${s.money}
                                    </c:if></td>
                                    <td><fmt:formatDate value="${s.createtime}"
                                                        type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                    <td><fmt:formatDate value="${s.usetime}"
                                                        type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                        <%--<td>--%>
                                        <%--<button type="button" class="btn btn-success btn-detail">查看详情</button>--%>
                                        <%--</td>--%>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="clearfix"></div>
                <br/>
            </div>
            <div style="width: 100%; text-align: center;">
                <div id='page'></div>
            </div>
        </div>
    </div>
</div>
<!-- jQuery -->
<script src="../vendors/jquery/dist/jquery.min.js"></script>
<!-- layui -->
<script src="../vendors/layui/layui.js"></script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#usetime1', //指定元素
        });
        laydate.render({
            elem: '#usetime2' //指定元素
        });
    });
</script>
<script>
    /**
     * 纯粹的JS分页插件，代码缺点：JS操作DOM冗余太多，太繁琐
     */
    pageUtil.initPage('page', {
        totalCount: '${pages.recordTotal}', //总页数，一般从回调函数中获取。如果没有数据则默认为1页
        curPage: ${pages.currentPageNo}, //初始化时的默认选中页，默认第一页。如果所填范围溢出或者非数字或者数字字符串，则默认第一页
        showCount: 9, //分页栏显示的数量
        pageSizeList: [10, 100, 1000], //自定义分页数，默认[5,10,15,20,50]
        defaultPageSize: ${pageSize}, //默认选中的分页数,默认选中第一个。如果未匹配到数组或者默认数组中，则也为第一个
        isJump: true, //是否包含跳转功能，默认false
        isPageNum: true, //是否显示分页下拉选择，默认false
        isPN: true, //是否显示上一页和下一面，默认true
        isFL: true, //是否显示首页和末页，默认true
        jump: function (curPage,pageSize) { //跳转功能回调，传递回来2个参数，当前页和每页大小。如果没有设置分页下拉，则第二个参数永远为0。这里的this被指定为一个空对象，如果回调中需用到this请自行使用bind方法
            selectALL(curPage, pageSize);
        },
    });
</script>
<script type="text/javascript">
    var orderNo = "";

    // 主页
    function selectALL(curPage, pageSize) {
        var usetime1 = $("#usetime1").val().trim();
        var usetime2 = $("#usetime2").val().trim();
        var regTime = /^([0-2][0-9][0-9][0-9])-([0-1][0-9])-([0-3][0-9])$/;
        if (usetime1.length != 0 && !regTime.test(usetime1)) {
            alert('请输入正确日期格式（例如：2018-01-01）');
            return false;
        }
        if (usetime2.length != 0 && !regTime.test(usetime2)) {
            alert('请输入正确日期格式（例如：2018-01-01）');
            return false;
        }
        if (usetime1==""&&usetime2==""){
            window.location.href = "content_recharge?"+ "pageSize=" + pageSize + "&currentPageNo=" + curPage;
            return
        }
        if (usetime1!=""&&usetime2==""){
            alert("时间2未填,跳转失败!");
            return false
        }
        if (usetime2!=""&&usetime1=="") {
            alert("时间1未填,跳转失败!");
            return false
        }
        var date1 = new Date(usetime1);
        var date2 = new Date(usetime2);
        if (date2 - date1 >=0) {
            window.location.href = "content_recharge?usetime1=" + usetime1 + "&currentPageNo=" + curPage + "&usetime2=" + usetime2 + "&pageSize=" + pageSize;
        } else {
            alert('时间1要比时间2小');
            return false;
        }

    }

    function BtnDetail() {
        $(".detailBox").show();
        $(".ShadowBox").show()
    }

    $(function () {
        $(".btn-detail").on("click", function () {
            $(".detailBox").show();
            $(".ShadowBox").show();
        });
        $(".closeBox").on("click", function () {
            $(".detailBox").hide();
            $(".ShadowBox").hide();
        });

    })
</script>
<!-- Bootstrap -->
<script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="../vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../vendors/nprogress/nprogress.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="../vendors/moment/min/moment.min.js"></script>
<script src="../vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- Chart.js -->
<script src="../vendors/Chart.js/dist/Chart.min.js"></script>
<!-- Custom Theme Scripts -->
<script src="../build/js/custom.min.js"></script>


</body>
</html>